package leecode

import "sort"

func countLatticePoints(circles [][]int) int {
	//二维数组按半径排序
	sort.Slice(circles, func(i, j int) bool {
		return circles[i][2] > circles[j][2]
	})
	var result int
	for x := 0; x <= 200; x++ {
		for y := 0; y <= 200; y++ {
			for _, circle := range circles {
				//判断x , y是否在圆圈内部
				if (circle[0]-x)*(circle[0]-x)+(circle[1]-y)*(circle[1]-y) <= circle[2]*circle[2] {
					result++
					break
				}
			}
		}
	}
	return result
}
